<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 审核 -->
    <!-- 引入样式 -->
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="../js/axios.min.js"></script>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<div id="head">
    <h2>{{massage}}</h2>
</div>
<div id="tableView">
<!--列表-->
<el-row>
    <el-table :data="tableData" v-loading.body="loading" border @selection-change="selectionChange" style="width: 100%">
        <el-table-column prop="id" label="标题" width="105"></el-table-column>
        <el-table-column prop="danwei" label="单位名称" width="150"></el-table-column>
        <el-table-column  :formatter="Tablestate" prop="state" label="审核状态" width="130"></el-table-column>
        <el-table-column prop="score" label="资料下载" width="100">
            <template scope="scope">
                <el-button :plain="true" type="success" size="small" icon="edit" @click="download(scope.row)">资料下载</el-button>
            </template>
        </el-table-column>
        <el-table-column label="操作">
            <template scope="scope">
                <el-button :plain="true" type="success" size="small" icon="edit" @click="editClick(scope.row)">审核/驳回</el-button>
            </template>
        </el-table-column>
    </el-table>



    <!-- 弹出层 -->
    <!--查看界面-->
    <el-dialog title="查看" :visible.sync="editFormVisible" :close-on-click-modal="false">
        <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm">

            <el-form-item label="申请标准" prop="qingdan">
                <el-input v-model="editForm.qingdan" auto-complete="off" disabled></el-input>
            </el-form-item>
            <el-form-item label="文件名" prop="filename">
                <el-input v-model="editForm.filename" auto-complete="off" disabled></el-input>
            </el-form-item>
            <el-form-item label="单位名称" prop="danwei">
                <el-input v-model="editForm.danwei" auto-complete="off" disabled></el-input>
            </el-form-item>
            <el-form-item label="申报等级" prop="level">
                <el-input v-model="editForm.level" auto-complete="off" disabled></el-input>
            </el-form-item>
            <el-form-item label="通过分数" prop="score">
                <el-select   v-model="editForm.score" placeholder="请选择">
                    <el-option value="0.5" lable="0.5分"></el-option>
                    <el-option value="1" lable="1分"></el-option>
                    <el-option value="1.5" lable="1.5分"></el-option>
                    <el-option value="2" lable="2分"></el-option>
                    <el-option value="2.5" lable="2.5分"></el-option>
                </el-select>
            </el-form-item>
                <el-input type="hidden" v-model="editForm.id" auto-complete="off" disabled></el-input>
                <el-input type="hidden" v-model="editForm.state" auto-complete="off" disabled></el-input>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button :disabled="SHgo"  @click="tongguo">通过</el-button>
            <el-button :disabled="SHreturn"  @click="bohui">驳回</el-button>
            <el-button @click.native="editFormVisible = false">取消</el-button>
        </div>
    </el-dialog>



</el-row>
</div>
</body>
<script>
    var head=new Vue({
        el:"#head",
        data:{
            massage:"申报审核",
        }
    })

    var tableView=new Vue({
        el:"#tableView",
        data:{
            //列表数据
            tableData: [
                {  filename:"",
                    danwei:"",
                    state:"",
                }
            ],
            //显示加载中样式
            loading:false,
            //当前页
            currentPage:1,
            //分页大小
            pageSize:6,
            //总记录数
            total:800,
            //删除的弹出框
            deleteVisible:false,
            //编辑界面是否显示
            editFormVisible: false,
            editLoading: false,
            goUrl:'',
            editFormRules: {
                name: [
                    { required: true, message: '请输入姓名', trigger: 'blur' }
                ]
            },
            editForm:{
                qingdan:"",
                filename:"",
            }
        },created:function(){
            var self=this;
            var start =(this.currentPage-1)*this.pageSize;
            axios.post('/dataSH/dataSH',{'start':start,'pageSize':this.pageSize}).then(function(response){
                self.tableData=response.data.data;
                self.total=response.data.total;


            });
        },methods:{
            loadingData: function () {
                var self=this;
                var start =(this.currentPage-1)*this.pageSize;
                axios.post('/dataSH/dataSH',{'start':start,'pageSize':this.pageSize}).then(function(response){
                        self.tableData=response.data.data;
                        self.total=response.data.total;
                });
            }
            ,
            //审核状态显示
            Tablestate:function(row){
                if (row.state==1){
                    return "审核通过";
                }else if(row.state==0) {
                    return "审核未通过";
                }else if(row.state==2){
                    return "审核驳回";
                }
            },
            
            //资料下载
            download:function (row) {
                window.location.href="/dataCX/downLoad?filePaths="+row.filepath;
            },
            //审核方法
            editClick:function (row) {
                var self=this;
                self.editFormVisible=true;
                self.editForm.qingdan=row.qingdan;
                self.editForm.filename=row.filename;
                self.editForm.danwei=row.danwei;
                self.editForm.level=row.level;
                self.editForm.id=row.id;
                self.editForm.state=row.state;
                if (row.state==1){
                    self.editFormVisible=false;
                    this.$notify.error({
                        title: '审核已通过！',
                        message: '请勿重复点击'
                    });
                }
                axios.post('').then(function(response){

                });
            },tongguo:function () {
                var self=this;
                var score=self.editForm.score;
                var id=self.editForm.id;
                var danwei=self.editForm.danwei
                var state=self.editForm.state
                var SH={"score":score,"id":id,"name":danwei};

                if (score==undefined){
                    this.$confirm('请输入分数通过审核', '提示', {
                        type: 'warning'
                    })
                }
                if (score!=undefined){
                    this.$confirm('确定通过审核？', '提示', {
                        type: 'warning'
                    }).then(function () {
                        axios.post('/dataSH/SHgo',SH).then(function (response) {
                            self.editFormVisible=false;
                            self.loadingData();
                        })
                    })
                }
            },bohui:function () {
                var self=this;
                var id=self.editForm.id;
                var ids={"id":id};
                this.$confirm('确定驳回该申报？', '提示', {
                    type: 'warning'
                }).then(function () {
                    axios.post('/dataSH/SHreturn',ids).then(function (response) {
                        self.editFormVisible=false;
                        self.loadingData();
                })
                })
            }

        }
    })

</script>
</html>